home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / ab20_archive / text / cmanual.lzh / ACM2.lzh / Requesters / Example8.c < prev    next >
C/C++ Source or Header  |  1990-01-30  |  23KB  |  575 lines

  1. /* Example8                                                             */
  2. /* This program will open a normal window which is connected to the     */
  3. /* Workbench Screen. The window will use all System Gadgets, and will   */
  4. /* close first when the user has selected the System gadget Close       */
  5. /* window. Inside the window we have activated an Application requester */
  6. /* with three connecting gadgets. Two are Boolean gadgets ("OK and      */
  7. /* "CANCEL"), and one is an Integer gadget.                             */
  8.  
  9.  
  10.  
  11. #include <intuition/intuition.h>
  12.  
  13.  
  14.  
  15. struct IntuitionBase *IntuitionBase;
  16.  
  17.  
  18.  
  19. /************************************/
  20. /* THE INTEGER GADGET's STRUCTURES: */
  21. /************************************/
  22.  
  23. /* The coordinates for the box around the integer gadget: */
  24. SHORT integer_border_points[]=
  25. {
  26.    -7, -4, /* Start at position (-7, -4) */
  27.   200, -4, /* Draw a line to the right to position (200,-4) */
  28.   200, 11, /* Draw a line down to position (200,11) */
  29.    -7, 11, /* Draw a line to the left to position (-7,11) */
  30.    -7, -4  /* Finish of by drawing a line up to position (-7,-4) */ 
  31. };
  32.  
  33. /* The Border structure for the integer gadget: */
  34. struct Border integer_border=
  35. {
  36.   0, 0,                 /* LeftEdge, TopEdge. */
  37.   1,                    /* FrontPen, colour register 1. */
  38.   0,                    /* BackPen, for the moment unused. */
  39.   JAM1,                 /* DrawMode, draw the lines with colour 1. */
  40.   5,                    /* Count, 5 pair of coordinates in the array. */
  41.   integer_border_points,/* XY, pointer to the array with the coordinates. */
  42.   NULL,                 /* NextBorder, no other Border structures. */
  43. };
  44.  
  45.  
  46.  
  47. /* The IntuiText structure for the integer gadget: */
  48. struct IntuiText integer_text=
  49. {
  50.   1,         /* FrontPen, colour register 1. (white) */
  51.   0,         /* BackPen, not used since JAM1. */
  52.   JAM1,      /* DrawMode, draw the characters with colour 1, and do not */
  53.              /* bother about the background. */ 
  54.   -53, 0,    /* LeftEdge, TopEdge. */
  55.   NULL,      /* ITextFont, use default font. */
  56.   "Age: ",   /* IText, the text that will be printed. */
  57.   NULL,      /* NextText, no other IntuiText structures. */
  58. };
  59.  
  60.  
  61.  
  62. UBYTE my_buffer[25]; /* 25 characters including the NULL-sign. */
  63. UBYTE my_undo_buffer[25]; /* Must be at least as big as my_buffer. */
  64.  
  65.  
  66.  
  67. struct StringInfo integer_info=
  68. {
  69.   my_buffer,       /* Buffer, pointer to a null-terminated string. */
  70.   my_undo_buffer,  /* UndoBuffer, pointer to a null-terminated string. */
  71.                    /* (Remember my_buffer is equal to &my_buffer[0]) */
  72.   0,               /* BufferPos, initial position of the cursor. */
  73.   25,              /* MaxChars, 25 characters inc. null-sign ('\0'). */
  74.   0,               /* DispPos, first character in the string should be */
  75.                    /* first character in the display. */
  76.  
  77.   /* Intuition initializes and maintaines these variables: */
  78.  
  79.   0,               /* UndoPos */
  80.   0,               /* NumChars */
  81.   0,               /* DispCount */
  82.   0, 0,            /* CLeft, CTop */
  83.   NULL,            /* LayerPtr */
  84.   NULL,            /* LongInt */
  85.   NULL,            /* AltKeyMap */
  86. };
  87.  
  88.  
  89. struct Gadget integer_gadget=
  90. {
  91.   NULL,          /* NextGadget, no more gadgets in the list. */
  92.   68,            /* LeftEdge, 68 pixels out. */
  93.   26,            /* TopEdge, 26 lines down. */
  94.   198,           /* Width, 198 pixels wide. */
  95.   8,             /* Height, 8 pixels lines heigh. */
  96.   GADGHCOMP,     /* Flags, draw the select box in the complement */
  97.                  /* colours. Note: it actually only the cursor which */
  98.                  /* will be drawn in the complement colours (yellow). */
  99.                  /* If you set the flag GADGHNONE the cursor will not be */
  100.                  /* highlighted, and the user will therefore not be able */
  101.                  /* to see it. */
  102.   GADGIMMEDIATE| /* Activation, our program will recieve a message when */
  103.   RELVERIFY|     /* the user has selected this gadget, and when the user */
  104.                  /* has released it. */ 
  105.   LONGINT,       /* An Integer gadget. */
  106.   STRGADGET|     /* GadgetType, a String gadget which is connected to */
  107.   REQGADGET,     /* a requester. IMPORTANT! Every gadget which is */
  108.                  /* connectd to a requester must have the REQGADGET flsg */
  109.                  /* set in the GadgetType field. */
  110.   (APTR) &integer_border, /* GadgetRender, a pointer to our Border struc. */
  111.   NULL,          /* SelectRender, NULL since we do not supply the gadget */
  112.                  /* with an alternative image. */
  113.   &integer_text,  /* GadgetText, a pointer to our IntuiText structure. */
  114.   NULL,          /* MutualExclude, no mutual exclude. */
  115.   (APTR) &integer_info, /* SpecialInfo, a pointer to a StringInfo str. */
  116.   0,             /* GadgetID, no id. */
  117.   NULL           /* UserData, no user data connected to the gadget. */
  118. };
  119.  
  120.  
  121.  
  122. /*******************************/
  123. /* THE OK GADGET's STRUCTURES: */
  124. /*******************************/
  125.  
  126. /* The coordinates for the OK box: */
  127. SHORT ok_border_points[]=
  128. {
  129.    0,  0, /* Start at position (0,0) */
  130.   22,  0, /* Draw a line to the right to position (22,0) */
  131.   22, 10, /* Draw a line down to position (22,10) */
  132.    0, 10, /* Draw a line to the left to position (0,10) */
  133.    0,  0  /* Finish of by drawing a line up to position (0,0) */ 
  134. };
  135.  
  136. /* The Border structure: */
  137. struct Border ok_border=
  138. {
  139.   0, 0,        /* LeftEdge, TopEdge. */
  140.   1,           /* FrontPen, colour register 1. */
  141.   0,           /* BackPen, for the moment unused. */
  142.   JAM1,        /* DrawMode, draw the lines with colour 1. */
  143.   5,           /* Count, 5 pair of coordinates in the array. */
  144.   ok_border_points, /* XY, pointer to the array with the coord. */
  145.   NULL,        /* NextBorder, no other Border structures are connected. */
  146. };
  147.  
  148. /* The IntuiText structure: */
  149. struct IntuiText ok_text=
  150. {
  151.   1,      /* FrontPen, colour register 1. */
  152.   0,      /* BackPen, not used since JAM1. */
  153.   JAM1,   /* DrawMode, draw the characters with colour 1, do not */
  154.           /* change the background. */ 
  155.   4, 2,   /* LeftEdge, TopEdge. */
  156.   NULL,   /* ITextFont, use default font. */
  157.   "OK",   /* IText, the text that will be printed. */
  158.   NULL,   /* NextText, no other IntuiText structures are connected. */
  159. };
  160.  
  161. struct Gadget ok_gadget=
  162. {
  163.   &integer_gadget, /* NextGadget, linked to the Integer gadget. */
  164.   14,            /* LeftEdge, 14 pixels out. */
  165.   47,            /* TopEdge, 47 lines down. */
  166.   23,            /* Width, 23 pixels wide. */
  167.   11,            /* Height, 11 pixels lines heigh. */
  168.   GADGHCOMP,     /* Flags, when this gadget is highlighted, the gadget */
  169.                  /* will be rendered in the complement colours. */
  170.                  /* (Colour 0 (00) will be changed to colour 3 (11) */
  171.                  /* (Colour 1 (01)           - " -           2 (10) */
  172.                  /* (Colour 2 (10)           - " -           1 (01) */
  173.                  /* (Colour 3 (11)           - " -           0 (00) */  
  174.   GADGIMMEDIATE| /* Activation, our program will recieve a message when */
  175.   RELVERIFY|     /* the user has selected this gadget, and when the user */
  176.                  /* has released it. */
  177.   ENDGADGET,     /* When the user has selected this gadget, the */
  178.                  /* requester is satisfied, and is deactivated. */
  179.                  /* IMPORTANT! At least one gadget per requester */
  180.                  /* must have the flag ENDGADGET set. If not, the */
  181.                  /* requester would never be deactivated! */
  182.  
  183.   BOOLGADGET|    /* GadgetType, a Boolean gadget which is connected to */
  184.   REQGADGET,     /* a requester. IMPORTANT! Every gadget which is */
  185.                  /* connectd to a requester must have the REQGADGET flsg */
  186.                  /* set in the GadgetType field. */
  187.   (APTR) &ok_border, /* GadgetRender, a pointer to our Border struc. */
  188.   NULL,          /* SelectRender, NULL since we do not supply the gadget */
  189.                  /* with an alternative image. (We complement the */
  190.                  /* colours instead) */
  191.   &ok_text,      /* GadgetText, a pointer to our IntuiText structure. */
  192.                  /* (See chapter 3 GRAPHICS for more information) */
  193.   NULL,          /* MutualExclude, no mutual exclude. */
  194.   NULL,          /* SpecialInfo, NULL since this is a Boolean gadget. */
  195.                  /* (It is not a Proportional/String or Integer gdget) */
  196.   0,             /* GadgetID, no id. */
  197.   NULL           /* UserData, no user data connected to the gadget. */
  198. };
  199.  
  200.  
  201.  
  202.  
  203. /***********************************/
  204. /* THE CANCEL GADGET's STRUCTURES: */
  205. /***********************************/
  206.  
  207. /* The coordinates for the CANCEL box: */
  208. SHORT cancel_border_points[]=
  209. {
  210.    0,  0, /* Start at position (0,0) */
  211.   54,  0, /* Draw a line to the right to position (54,0) */
  212.   54, 10, /* Draw a line down to position (54,10) */
  213.    0, 10, /* Draw a line to the left to position (0,10) */
  214.    0,  0  /* Finish of by drawing a line up to position (0,0) */ 
  215. };
  216.  
  217. /* The Border structure: */
  218. struct Border cancel_border=
  219. {
  220.   0, 0,        /* LeftEdge, TopEdge. */
  221.   1,           /* FrontPen, colour register 1. */
  222.   0,           /* BackPen, for the moment unused. */
  223.   JAM1,        /* DrawMode, draw the lines with colour 1. */
  224.   5,           /* Count, 5 pair of coordinates in the array. */
  225.   cancel_border_points, /* XY, pointer to the array with the coord. */
  226.   NULL,        /* NextBorder, no other Border structures are connected. */
  227. };
  228.  
  229. /* The IntuiText structure: */
  230. struct IntuiText cancel_text=
  231. {
  232.   1,        /* FrontPen, colour register 1. */
  233.   0,        /* BackPen, not used since JAM1. */
  234.   JAM1,     /* DrawMode, draw the characters with colour 1, do not */
  235.             /* change the background. */ 
  236.   4, 2,     /* LeftEdge, TopEdge. */
  237.   NULL,     /* ITextFont, use default font. */
  238.   "CANCEL", /* IText, the text that will be printed. */
  239.   NULL,     /* NextText, no other IntuiText structures are connected. */
  240. };
  241.  
  242. struct Gadget cancel_gadget=
  243. {
  244.   &ok_gadget,    /* NextGadget, linked to the OK gadget. */
  245.   214,           /* LeftEdge, 214 pixels out. */
  246.   47,            /* TopEdge, 47 lines down. */
  247.   55,            /* Width, 55 pixels wide. */
  248.   11,            /* Height, 11 pixels lines heigh. */
  249.   GADGHCOMP,     /* Flags, when this gadget is highlighted, the gadget */
  250.                  /* will be rendered in the complement colours. */
  251.                  /* (Colour 0 (00) will be changed to colour 3 (11) */
  252.                  /* (Colour 1 (01)           - " -           2 (10) */
  253.                  /* (Colour 2 (10)           - " -           1 (01) */
  254.                  /* (Colour 3 (11)           - " -           0 (00) */  
  255.   GADGIMMEDIATE| /* Activation, our program will recieve a message when */
  256.   RELVERIFY|     /* the user has selected this gadget, and when the user */
  257.                  /* has released it. */
  258.   ENDGADGET,     /* When the user has selected this gadget, the */
  259.                  /* requester is satisfied, and is deactivated. */
  260.                  /* IMPORTANT! At least one gadget per requester */
  261.                  /* must have the flag ENDGADGET set. If not, the */
  262.                  /* requester would never be deactivated! */
  263.  
  264.   BOOLGADGET|    /* GadgetType, a Boolean gadget which is connected to */
  265.   REQGADGET,     /* a requester. IMPORTANT! Every gadget which is */
  266.                  /* connectd to a requester must have the REQGADGET flsg */
  267.                  /* set in the GadgetType field. */
  268.   (APTR) &cancel_border, /* GadgetRender, a pointer to our Border struc. */
  269.   NULL,          /* SelectRender, NULL since we do not supply the gadget */
  270.                  /* with an alternative image. (We complement the */
  271.                  /* colours instead) */
  272.   &cancel_text,  /* GadgetText, a pointer to our IntuiText structure. */
  273.                  /* (See chapter 3 GRAPHICS for more information) */
  274.   NULL,          /* MutualExclude, no mutual exclude. */
  275.   NULL,          /* SpecialInfo, NULL since this is a Boolean gadget. */
  276.                  /* (It is not a Proportional/String or Integer gdget) */
  277.   0,             /* GadgetID, no id. */
  278.   NULL           /* UserData, no user data connected to the gadget. */
  279. };
  280.  
  281.  
  282.  
  283. /************************************************************************/
  284. /* Note:                                                                */
  285. /* Remember that every gadget which is connected to a requester must    */
  286. /* have the flag REQGADGET set in the GadgetType field. Remember also   */
  287. /* that at least one gadget per requester must have the ENDGADGET flag  */
  288. /* set in the Activation field.                                         */
  289. /* In this example we have three gadgets connected to the requester.    */
  290. /* All of them has the REQGADGET flag set, and the OK and CANCEL gadget */
  291. /* has also the ENDGADGET flag set.                                     */
  292. /************************************************************************/
  293.  
  294.  
  295.  
  296. /************************************/
  297. /* THE BORDER AROUND THE REQUESTER: */
  298. /************************************/
  299.  
  300. /* The coordinates for the box around the requester: */
  301. SHORT requester_border_points[]=
  302. {
  303.     0,  0, /* Start at position (0,0) */
  304.   282,  0, /* Draw a line to the right. */
  305.   282, 64, /* Draw a line down. */
  306.     0, 64, /* Draw a line to the left. */
  307.     0,  0  /* Finish of by drawing a line up to position (0,0) */ 
  308. };
  309.  
  310. /* The Border structure for the requester: */
  311. struct Border requester_border=
  312. {
  313.   0, 0,        /* LeftEdge, TopEdge. */
  314.   1,           /* FrontPen, colour register 1. */
  315.   0,           /* BackPen, for the moment unused. */
  316.   JAM1,        /* DrawMode, draw the lines with colour 1. */
  317.   5,           /* Count, 5 pair of coordinates in the array. */
  318.   requester_border_points, /* XY, pointer to the array with the coord. */
  319.   NULL,        /* NextBorder, no other Border structures are connected. */
  320. };
  321.  
  322.  
  323.  
  324. /**********************************/
  325. /* THE TEXT INSIDE THE REQUESTER: */
  326. /**********************************/
  327.  
  328. /* The IntuiText structure used to print some text inside the requester: */
  329. struct IntuiText requester_text=
  330. {
  331.   1,         /* FrontPen, colour register 1. */
  332.   0,         /* BackPen, unused since JAM1. */
  333.   JAM1,      /* DrawMode, draw the characters with colour 1, do not */
  334.              /* change the background. */ 
  335.   14, 8,     /* LeftEdge, TopEdge. */
  336.   NULL,      /* ITextFont, use default font. */
  337.   "Please enter your age:", /* IText, the text that will be printed. */
  338.   NULL,      /* NextText, no other IntuiText structures are connected. */
  339. };
  340.  
  341.  
  342.  
  343. /****************************/
  344. /* THE REQUESTER STRUCTURE: */
  345. /****************************/
  346.  
  347. struct Requester my_requester=
  348. {
  349.   NULL,              /* OlderRequester, used by Intuition. */
  350.   40, 20,            /* LeftEdge, TopEdge, 40 pixels out, 20 lines down. */
  351.   283, 65,           /* Width, Height, 283 pixels wide, 65 lines high. */
  352.   0, 0,              /* RelLeft, RelTop, Since POINTREL flag is not set, */
  353.                      /* Intuition ignores these values. */
  354.   &cancel_gadget,    /* ReqGadget, pointer to the first gadget. */
  355.   &requester_border, /* ReqBorder, pointer to a Border structure. */
  356.   &requester_text,   /* ReqText, pointer to a IntuiText structure. */
  357.   NULL,              /* Flags, no flags set. */
  358.   2,                 /* BackFill, draw everything on a black background. */
  359.   NULL,              /* ReqLayer, used by Intuition. Set to NULL. */
  360.   NULL,              /* ReqPad1, used by Intuition. Set to NULL. */
  361.   NULL,              /* ImageBMap, no predrawn Bitmap. Set to NULL. */
  362.                      /*            (The PREDRAWN flag was not set) */
  363.   NULL,              /* RWindow, used by Intuition. Set to NULL. */
  364.   NULL               /* ReqPad2, used by Intuition. Set to NULL. */
  365. };
  366.  
  367.  
  368.  
  369. /* Declare a pointer to a Window structure: */ 
  370. struct Window *my_window;
  371.  
  372. /* Declare and initialize your NewWindow structure: */
  373. struct NewWindow my_new_window=
  374. {
  375.   0,             /* LeftEdge    x position of the window. */
  376.   0,             /* TopEdge     y positio of the window. */
  377.   640,           /* Width       640 pixels wide. */
  378.   200,           /* Height      200 lines high. */
  379.   0,             /* DetailPen   Text should be drawn with colour reg. 0 */
  380.   1,             /* BlockPen    Blocks should be drawn with colour reg. 1 */
  381.   CLOSEWINDOW|   /* IDCMPFlags  The window will give us a message if the */
  382.                  /*             user has selected the Close window gad, */
  383.   GADGETDOWN|    /*             or a gadget has been pressed on, or */
  384.   GADGETUP|      /*             a gadge has been released. */
  385.   REQSET|        /*             Send a message also if a requester has */
  386.   REQCLEAR,      /*             been activated or deactivated. */
  387.   SMART_REFRESH| /* Flags       Intuition should refresh the window. */
  388.   WINDOWCLOSE|   /*             Close Gadget. */
  389.   WINDOWDRAG|    /*             Drag gadget. */
  390.   WINDOWDEPTH|   /*             Depth arrange Gadgets. */
  391.   WINDOWSIZING|  /*             Sizing Gadget. */
  392.   ACTIVATE,      /*             The window should be Active when opened. */
  393.   NULL,          /* FirstGadget No gadget connected to this window. */
  394.   NULL,          /* CheckMark   Use Intuition's default CheckMark. */
  395.   "The Window",  /* Title       Title of the window. */
  396.   NULL,          /* Screen      Connected to the Workbench Screen. */
  397.   NULL,          /* BitMap      No Custom BitMap. */
  398.   140,           /* MinWidth    We will not allow the window to become */
  399.   50,            /* MinHeight   smaller than 140 x 50, and not bigger */
  400.   300,           /* MaxWidth    than 300 x 200. */
  401.   200,           /* MaxHeight */
  402.   WBENCHSCREEN   /* Type        Connected to the Workbench Screen. */
  403. };
  404.  
  405.  
  406.  
  407. main()
  408. {
  409.   /* Boolean variable used for the while loop: */
  410.   BOOL close_me;
  411.  
  412.   /* Declare a variable in which we will store the IDCMP flag: */
  413.   ULONG class;
  414.   
  415.   /* Declare a variable in which we will store the address of the */
  416.   /* gadget which sent the message: */
  417.   APTR address;
  418.   
  419.   /* Declare a pointer to an IntuiMessage structure: */
  420.   struct IntuiMessage *my_message;
  421.  
  422.   /* We use this variable to check if the requester has ben activated */
  423.   /* or not: */
  424.   BOOL result;
  425.  
  426.  
  427.  
  428.   /* Put an integer value in the string: */
  429.   /* This is very important! */
  430.   strcpy( my_buffer, "0" );
  431.  
  432.  
  433.  
  434.   /* Before we can use Intuition we need to open the Intuition Library: */
  435.   IntuitionBase = (struct IntuitionBase *)
  436.     OpenLibrary( "intuition.library", 0 );
  437.   
  438.   if( IntuitionBase == NULL )
  439.     exit(); /* Could NOT open the Intuition Library! */
  440.  
  441.  
  442.  
  443.   /* We will now try to open the window: */
  444.   my_window = (struct Window *) OpenWindow( &my_new_window );
  445.   
  446.   /* Have we opened the window succesfully? */
  447.   if(my_window == NULL)
  448.   {
  449.     /* Could NOT open the Window! */
  450.     
  451.     /* Close the Intuition Library since we have opened it: */
  452.     CloseLibrary( IntuitionBase );
  453.  
  454.     exit();  
  455.   }
  456.  
  457.  
  458.  
  459.   /* We have opened the window, and everything seems to be OK. */
  460.  
  461.  
  462.  
  463.   /* We will now try to activate the requester: */
  464.   result=Request( &my_requester, my_window );
  465.  
  466.   if( !result )  /* !result is the same thing as result==FALSE */
  467.   {
  468.     /* Intuition could not activate the requester! */
  469.     /* In this case we do not need to quit since it does not matter if */
  470.     /* the requester was activated or not. I just wanted to show how */
  471.     /* you can check if you have opened or not the requester. */
  472.   
  473.     printf("Could not activate the requester!\n");
  474.   }
  475.   else
  476.   {
  477.     /* Intuition could open the requester! */
  478.     printf("Try to close the window!\n");
  479.   }
  480.  
  481.  
  482.  
  483.   close_me = FALSE;
  484.  
  485.   /* Stay in the while loop until the user has selected the Close window */
  486.   /* gadget. However, in this example the user first need to deactivate */
  487.   /* the requester before he can select the Close window gadget: */
  488.   while( !close_me )
  489.   {
  490.     /* Wait until we have recieved a message: */
  491.     Wait( 1 << my_window->UserPort->mp_SigBit );
  492.  
  493.     /* As long as we collect messages sucessfully: */
  494.     while(my_message=(struct IntuiMessage *) GetMsg(my_window->UserPort))
  495.     {
  496.       /* After we have collected the message we can read it, and save any */
  497.       /* important values which we maybe want to check later: */
  498.       
  499.       /* Store the IDCMP flag: */
  500.       class = my_message->Class;
  501.  
  502.       /* Store the address: */
  503.       address = my_message->IAddress;
  504.  
  505.       /* After we have read it we reply as fast as possible: */
  506.       /* REMEMBER! Do never try to read a message after you have replied! */
  507.       /* Some other process has maybe changed it. */
  508.       ReplyMsg( my_message );
  509.  
  510.       /* Check which IDCMP flag was sent: */
  511.       switch( class )
  512.       {
  513.         case CLOSEWINDOW:  /* The user selected the Close window gadget! */
  514.                close_me=TRUE;
  515.                break;
  516.              
  517.         case GADGETDOWN:   /* The user has pressed on a gadget. */
  518.                
  519.                if( address == (APTR) &ok_gadget )
  520.                  printf("The user pressed on the OK gadget!\n");
  521.  
  522.                if( address == (APTR) &cancel_gadget )
  523.                  printf("The user pressed on the CANCEL gadget!\n");
  524.                  
  525.                if( address == (APTR) &integer_gadget )
  526.                  printf("The user selected the Integer gadget!\n");
  527.                
  528.                break;
  529.              
  530.         case GADGETUP:     /* The user has released a gadget. */
  531.  
  532.                if( address == (APTR) &ok_gadget )
  533.                  printf("The user released the OK gadget!\n");
  534.  
  535.                if( address == (APTR) &cancel_gadget )
  536.                  printf("The user released the CANCEL gadget!\n");
  537.                  
  538.                if( address == (APTR) &integer_gadget )
  539.                {
  540.                  printf("The user released the Integer gadget!\n");
  541.                  
  542.                  /* Print out the integer value: */
  543.                  printf("Nr: %d\n\n", integer_info.LongInt);
  544.                }
  545.                break;
  546.                
  547.         case REQSET:       /* Requester activated. */
  548.               printf("Requester activated!\n");
  549.               break;
  550.  
  551.         case REQCLEAR:     /* Requester deactivated. */
  552.               printf("Requester deactivated!\n");
  553.               printf("You can now close the window.\n");
  554.               break;
  555.       }
  556.     }
  557.   }
  558.  
  559.  
  560.  
  561.   /* Print out the integer value: */
  562.   printf("Nr: %d\n\n", integer_info.LongInt);
  563.  
  564.  
  565.  
  566.   /* We should always close the windows we have opened before we leave: */
  567.   CloseWindow( my_window );
  568.  
  569.  
  570.  
  571.   /* Close the Intuition Library since we have opened it: */
  572.   CloseLibrary( IntuitionBase );
  573.   
  574.   /* THE END */
  575. }